home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5993 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  36 lines

  1. Newsgroups: comp.lang.c
  2. Path: in2.uu.net!pgh!cliff
  3. From: cliff@pgh.nauticom.net (Cliff Frescura K3LL)
  4. Subject: Re: malloc failure
  5. Message-ID: <Dn5ovo.F9K@pgh.nauticom.net>
  6. Date: Thu, 22 Feb 1996 02:42:59 GMT
  7. References: <4a9c7v$7jb@gsusgi1.gsu.edu> <4aicjc$js@news.cerf.net>
  8. Organization: Nauticom - Internet Access Provider
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Mike Lee (mikey@banzai.ontek.com) wrote:
  12. : In comp.lang.c, matmrlx@gsusgi1.gsu.edu (Michael R. Lauer) writes:
  13. : | Every time I call malloc I test the return for NULL, but when it does
  14. : | fail, what can I do--assuming I really need the space--to recover?
  15. : | Exiting the program seems to be an inadequate solution.
  16.  
  17. : An unusual solution is to just wait patiently for more memory to
  18. : become available.  On most unix machines, virtual memory can be
  19. : added to a running system.  On PC's and Mac's, you can usually free
  20. : up some memory by exiting other programs or turning off some
  21. : operating system features.  Once some memory is made available,
  22. : by whatever means, your program can then continue without incident.
  23.  
  24. :      mikey
  25.  
  26. Or, if you are *really* desperate, code up your own malloc which 
  27. will use free disk space instead of memory.  Maybe later it could
  28. be moved to memory when it becomes available.  (I did say desperate!)
  29.  
  30. -Cliff
  31. -- 
  32.  
  33. +----------------------------------------------------------------------+
  34. |cliff@nauticom.net                  "All bags are subject to search." |
  35. | k3ll@nauticom.net                  "Adapt, Migrate, or Die."         |
  36.